<?php
        //$prideGroup = $_GET['pride_group'];
        
        $sql = "SELECT 	ti_id,ti_img,ti_msg,ti_active FROM translation_interpreter ORDER BY ti_position";
        $result = $db->Execute($sql);
        $pride_student_list = '';
        while (!$result->EOF)
        {
            $psMsg = substr($result->fields['ti_msg'],0,250);
            if($result->fields['ti_active']==1){
                $psActive = '<img src="images/active.png" class="img_link showHideAction" id="'.$result->fields['ti_id'].'" title="Click to hide"/>';
            }else{
                $psActive = '<img src="images/unactive.png" class="img_link showHideAction" id="'.$result->fields['ti_id'].'" title="Click to show"/>';
            }
            $pride_student_list .= <<<stu_hall_of_fame
                <tr>
                    <td class="align_center"><img src="{$iniVars['Locations']['siteurl']}{$result->fields['ti_img']}" class="prideStudentImg"/></td>
                    <td>{$psMsg}</td>
                    <td class="align_center">{$psActive}<a title="Edit" href="pages/translation_interpreter-thank-edit.php?psid={$result->fields['ti_id']}" class="aColorBox"><img src="images/edit.png" /></a><img src="images/system-delete-alt-02.png" class="img_link deleteImg" id="{$result->fields['ti_id']}" title="Delete"/></td>
                </tr>
stu_hall_of_fame;
            $result->MoveNext();
        }
        $result->Close();
    ?>
    <script src="js/jquery.dataTables.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/jquery.colorbox-min.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" href="css/datatable.css" type="text/css" media="screen" charset="utf-8" /script>
    <link rel="stylesheet" href="css/colorbox.css" type="text/css" media="screen" charset="utf-8" />
    <script type="text/javascript">
        $(function() {
            $("#tabs").tabs();
        });
        
        $(document).ready(function(){
            $('.aColorBox').colorbox({width:'300',height:'90%'});
            
            $('#prideStudentList').dataTable({
                "aoColumns": [
                   { "bSortable": false, "bSearchable": false },
                   { "bSortable": false, "bSearchable": true },
                   { "bSortable": false, "bSearchable": false }
                ]
            });
            
            $('.showHideAction').click(function(){
                var psid = $(this).attr('id');
                $.post('function/translationInterpreterShowHideAction.php','psid='+psid,function(data){
                    if(trim(data)=='success'){
                        location.reload();
                    }else{
                        alert('ไม่สามารถเปลี่ยนสถานะได้ กรุณาลองใหม่อีกครั้ง');
                    }
                });
            });
            
            $('.deleteImg').click(function(){
                if(confirm('Delete?')){
                    var psid = $(this).attr('id');
                    $.post('function/translationInterpreterDelete.php','psid='+psid,function(data){
                        if(trim(data)=='success'){
                            location.reload();
                        }else{
                            alert('ไม่สามารถลบข้อมูลได้ กรุณาลองใหม่อีกครั้ง');
                        }
                    });
                }
            });
        });
        
    </script>
    <h3 class="pageTitle">จัดการหน้า บริการแปลและงานล่าม : คำขอบคุณ</h3>
    <div id="tabs" class="prideStudent">
        
        <ul>
            <li id="car_"><a href="#tabs-1" title="Add files">คำขอบคุณ</a></li>
        </ul>
        
        <div id="tabs-1" class="prideStudentList">
            <div style="margin-bottom:25px;text-align:right;">
                <a href="pages/translation_interpreter-thank-add.php" class="aColorBox"><img src="images/add.jpg" class="img_link"/></a>
            </div>
            <table class="display" id="prideStudentList">
                <thead>
                    <tr>
                        <th>Image</th>
                        <th>Message</th>
                        <th>Show / Edit / Delete</th>
                    </tr>
                </thead>
                <tbody>
                <?php echo $pride_student_list; ?>
                </tbody>
            </table>
            <div class="clear"></div>
        </div>
        
    </div>